package com.wym.rbac.domain.vo;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class R {
    private int code;
    private String msg;
    private String status;
    private Object data;
    public static final String SUCCESS="success";
    public static final String FAIL="fail";
    public static R ok(){return new R(200, "", SUCCESS, null);}
    public static R ok(String msg){return new R(200, msg, SUCCESS, null);}

    public static R ok(Object data){return new R(200, "", SUCCESS, data);}
    public static R ok(String msg,Object data){return new  R(200, msg, SUCCESS, data);}

    public static R error(){return new R(500, "", FAIL, null);}
    public static R error(String msg){return new R(500, msg, FAIL, null);}
    public static R error(int code){return new R(code, "", FAIL, null);}

    public static R error(int code,String msg){return new R(code, msg, FAIL, null);}
}
